package io.github.xbeeant.eoffice.service.impl;

import io.github.xbeeant.core.IdWorker;
import io.github.xbeeant.eoffice.config.AbstractSecurityMybatisPageHelperServiceImpl;
import io.github.xbeeant.eoffice.mapper.ResourcesEventMapper;
import io.github.xbeeant.eoffice.model.ResourcesEvent;
import io.github.xbeeant.eoffice.service.IResourcesEventService;
import io.github.xbeeant.spring.mybatis.pagehelper.IMybatisPageHelperDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 用户资源操作历史
 */
@Service
public class ResourcesEventServiceImpl extends AbstractSecurityMybatisPageHelperServiceImpl<ResourcesEvent, Long> implements IResourcesEventService {

    @Autowired
    private ResourcesEventMapper resourcesEventMapper;

    @Override
    public boolean isWithBlobs() {
        return true;
    }

    @Override
    public IMybatisPageHelperDao<ResourcesEvent, Long> getRepositoryDao() {
        return this.resourcesEventMapper;
    }

    @Override
    public void setDefaults(ResourcesEvent record) {
        if (record.getEid() == null) {
            record.setEid(IdWorker.getId());
        }
    }
}
